#include <stdio.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>

int main()
{
    pid_t id = fork();
    if(id == 0)
    {
        execlp("ls","ls","-a","-l",NULL);
        exit(1);
    }
    else if(id>0)
    {
        int ret = wait(NULL);
        if(ret<0)
        {
            perror("wait failed");
        }
        else
        {
            printf("wait success\n");
        }
    }
    else
    {
        perror("fork failed");
        exit(1);
    }

	return 0;
}




